﻿<UserControl x:Class="WpfImageDuplicates.FilterCollectionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:y="clr-namespace:WpfImageDuplicates"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="24"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*"/>
            <ColumnDefinition Width="0.5*"/>
        </Grid.ColumnDefinitions>
        <ListBox Grid.Row="0" Name="lstItems" ItemsSource="{Binding}"  SelectionMode="Multiple" KeyDown="lstItems_KeyDown"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border Width="Auto" Height="Auto" BorderBrush="Black" BorderThickness="1,1,1,1">
                        <y:FilterView x:Name="filterView" Padding="4,4,4,4" FilterViewModel="{Binding}" Width="Auto" Height="Auto"
                                      WantRemoveFilter="filterView_WantRemoveFilter"
                                      WantMoveLeft="filterView_WantMoveLeft"
                                      WantMoveRight="filterView_WantMoveRight"/>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>        
        <y:ShowAvailableFilters x:Name="showAvailable" Grid.Column="1" WantAddFilter="showAvailable_WantAdd"/>
        <Grid Grid.Column="1" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition Width="0.5*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="btnAddFilter" Click="btnAddFilter_Click" Content="Add Filter"></Button>
            <ToggleButton Grid.Column="1" IsChecked="{Binding Mode=TwoWay, Path=WantFilterThumbs}" Content="Filter Thumbnails"/>
        </Grid>
        
        <Grid Grid.Column="0" Grid.Row="1" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.33*"/>
                <ColumnDefinition Width="0.33*"/>
                <ColumnDefinition Width="0.34*"/>
            </Grid.ColumnDefinitions>
            <ToggleButton Grid.Column="0" x:Name="btnToggle" IsChecked="{Binding Mode=TwoWay, Path=Active}">
                <ToggleButton.Content>
                    <TextBlock Text="Toggle"/>
                </ToggleButton.Content>
            </ToggleButton>
            <Button Grid.Column="1" x:Name="btnClearFilters" Click="btnClearFilters_Click" Content="Clear Filters"></Button>
            <Button Grid.Column="2" x:Name="btnRemoveSelected" Click="btnRemoveSelected_Click" Content="Remove Selected"></Button>
        </Grid>        
    </Grid>
</UserControl>
